const path = require('path');
const resolve = function (dir) {
  return path.join(__dirname, '.', dir);
};
const { override, fixBabelImports, addWebpackAlias, addLessLoader, disableEsLint } = require('customize-cra');
module.exports = override(
  fixBabelImports('import', {
    libraryName: 'antd-mobile',
    // change importing css to less
    style: true,
  }),
   // eslint支持
   disableEsLint(),
  addLessLoader({
    javascriptEnabled: true,
    // Less Modules 动态命名格式，if you use CSS Modules, and custom `localIdentName`, default is '[local]--[hash:base64:5]'.
    // 支持参数 [path], [name], [local], and [hash:base64]
    // modules: true,
    // localIdentName: '[name]--[hash:base64:5]',
    // 定制主体 https://ant.design/docs/react/customize-theme-cn
    modifyVars: {
      "@brand-primary": "#0066FF"
    }
  }),
  // Alias支持，使用TS Alias
  addWebpackAlias({
    '@src': resolve('../src'),
    // 处理antd默认打包所有icon的问题
    // "@ant-design/icons": "purched-antd-icons"
  }),
);
